<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Update transform API | ElasticSearch 7.7 权威指南中文版</title>
	<meta name="keywords" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <meta name="description" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
	<script>
	var _link = 'update-transform.html';
    </script>
</head>
<body>
<div class="main-container">
    <section id="content">
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.7/update-transform.html" rel="nofollow" target="_blank">https://www.elastic.co/guide/en/elasticsearch/reference/7.7/update-transform.html</a>, 原文档版权归 www.elastic.co 所有<br/>本地英文版地址: <a href="../en/update-transform.html" rel="nofollow" target="_blank">../en/update-transform.html</a></div>
                        <!-- start body -->
                  <div class="page_header">
<strong>重要</strong>: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" rel="nofollow">当前版本文档</a>。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch Guide [7.7]</a></span>
»
<span class="breadcrumb-link"><a href="rest-apis.html">REST APIs</a></span>
»
<span class="breadcrumb-link"><a href="transform-apis.html">Transform APIs</a></span>
»
<span class="breadcrumb-node">Update transform API</span>
</div>
<div class="navheader">
<span class="prev">
<a href="stop-transform.html">« Stop transforms API</a>
</span>
<span class="next">
<a href="usage-api.html">Usage API »</a>
</span>
</div>
<div class="section xpack">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="update-transform"></a>Update transform API<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/transform/apis/update-transform.asciidoc">edit</a><a class="xpack_tag" href="https://www.elastic.co/subscriptions"></a>
</h2>
</div></div></div>

<p>Updates certain properties of a transform.</p>
<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="update-transform-request"></a>Request<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/transform/apis/update-transform.asciidoc">edit</a>
</h3>
</div></div></div>
<p><code class="literal">POST _transform/&lt;transform_id&gt;/_update</code></p>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="update-transform-prereqs"></a>Prerequisites<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/transform/apis/update-transform.asciidoc">edit</a>
</h3>
</div></div></div>
<p>If the Elasticsearch security features are enabled, you must have the following
built-in roles and privileges:</p>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<code class="literal">transform_admin</code>
</li>
<li class="listitem">
<code class="literal">manage_transform</code> (the built-in <code class="literal">transform_admin</code> role has this privilege)
</li>
<li class="listitem">
source index: <code class="literal">read</code>, <code class="literal">view_index_metadata</code>
</li>
<li class="listitem">
destination index: <code class="literal">read</code>, <code class="literal">create_index</code>, <code class="literal">index</code>
</li>
</ul>
</div>
<p>For more information, see <a class="xref" href="security-privileges.html" title="Security privileges">Security privileges</a> and <a class="xref" href="built-in-roles.html" title="Built-in roles">Built-in roles</a>.</p>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="update-transform-desc"></a>Description<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/transform/apis/update-transform.asciidoc">edit</a>
</h3>
</div></div></div>
<p>This API updates an existing transform. The list of properties that you can
update is a subset of the list that you can define when you create a transform.</p>
<p>When the transform is updated, a series of validations occur to ensure its
success. You can use the <code class="literal">defer_validation</code> parameter to skip these checks.</p>
<p>All updated properties except description do not take effect until after the
transform starts the next checkpoint. This is so there is consistency with the
pivoted data in each checkpoint.</p>
<div class="important admon">
<div class="icon"></div>
<div class="admon_content">
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
When Elasticsearch security features are enabled, your transform remembers which
roles the user who updated it had at the time of update and runs with those
privileges.
</li>
<li class="listitem">
You must use Kibana or this API to update a transform. Do not update a
transform directly via <code class="literal">.transform-internal*</code> indices using the Elasticsearch index API.
If Elasticsearch security features are enabled, do not give users any privileges on
<code class="literal">.transform-internal*</code> indices. If you used transforms prior 7.5, also do not
give users any privileges on <code class="literal">.data-frame-internal*</code> indices.
</li>
</ul>
</div>
</div>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="update-transform-path-parms"></a>Path parameters<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/transform/apis/update-transform.asciidoc">edit</a>
</h3>
</div></div></div>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">&lt;transform_id&gt;</code>
</span>
</dt>
<dd>
(Required, string)
Identifier for the transform. This identifier can contain lowercase
alphanumeric characters (a-z and 0-9), hyphens, and underscores. It must start
and end with alphanumeric characters.
</dd>
</dl>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="update-transform-query-parms"></a>Query parameters<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/transform/apis/update-transform.asciidoc">edit</a>
</h3>
</div></div></div>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">defer_validation</code>
</span>
</dt>
<dd>
(Optional, boolean) When <code class="literal">true</code>, deferrable validations are not run. This
behavior may be desired if the source index does not exist until after the
transform is updated.
</dd>
</dl>
</div>
</div>

<div class="section child_attributes">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="update-transform-request-body"></a>Request body<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/transform/apis/update-transform.asciidoc">edit</a>
</h3>
</div></div></div>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">description</code>
</span>
</dt>
<dd>
(Optional, string) Free text description of the transform.
</dd>
</dl>
</div>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">dest</code>
</span>
</dt>
<dd>
<p>
(Optional, object)
The destination for the transform.
</p>
<details open>
<summary class="title">Properties of <code class="literal">dest</code></summary>
<div class="content">
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">index</code>
</span>
</dt>
<dd>
(Required, string)
The <em>destination index</em> for the transform.
</dd>
<dt>
<span class="term">
<code class="literal">pipeline</code>
</span>
</dt>
<dd>
(Optional, string)
The unique identifier for a <a class="xref" href="pipeline.html" title="Pipeline Definition">pipeline</a>.
</dd>
</dl>
</div>
</div>
</details>
</dd>
<dt>
<span class="term">
<code class="literal">frequency</code>
</span>
</dt>
<dd>
(Optional, <a class="xref" href="common-options.html#time-units" title="Time units">time units</a>)
The interval between checks for changes in the source indices when the
transform is running continuously. Also determines the retry interval in the
event of transient failures while the transform is searching or indexing. The
minimum value is <code class="literal">1s</code> and the maximum is <code class="literal">1h</code>. The default value is <code class="literal">1m</code>.
</dd>
</dl>
</div>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">source</code>
</span>
</dt>
<dd>
<p>
(Optional, object)
The source of the data for the transform.
</p>
<details open>
<summary class="title">Properties of <code class="literal">source</code></summary>
<div class="content">
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">index</code>
</span>
</dt>
<dd>
(Required, string or array)
The <em>source indices</em> for the transform. It can be a single index, an index
pattern (for example, <code class="literal">"myindex*"</code>), an array of indices (for example,
<code class="literal">["index1", "index2"]</code>), or an array of index patterns (for example,
<code class="literal">["myindex1-*", "myindex2-*"]</code>.
</dd>
<dt>
<span class="term">
<code class="literal">query</code>
</span>
</dt>
<dd>
(Optional, object)
A query clause that retrieves a subset of data from the source index. See
<a class="xref" href="query-dsl.html" title="Query DSL">Query DSL</a>.
</dd>
</dl>
</div>
</div>
</details>
</dd>
</dl>
</div>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">sync</code>
</span>
</dt>
<dd>
<p>
(Optional, object)
Defines the properties transforms require to run continuously.
</p>
<details open>
<summary class="title">Properties of <code class="literal">sync</code></summary>
<div class="content">
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">time</code>
</span>
</dt>
<dd>
<p>
(Required, object)
Specifies that the transform uses a time field to synchronize the source and
destination indices.
</p>
<details open>
<summary class="title">Properties of <code class="literal">time</code></summary>
<div class="content">
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">delay</code>
</span>
</dt>
<dd>
(Optional, <a class="xref" href="common-options.html#time-units" title="Time units">time units</a>)
The time delay between the current time and the latest input data time. The
default value is <code class="literal">60s</code>.
</dd>
<dt>
<span class="term">
<code class="literal">field</code>
</span>
</dt>
<dd>
<p>
(Required, string)
The date field that is used to identify new documents in the source.
</p>
<div class="tip admon">
<div class="icon"></div>
<div class="admon_content">
<p>In general, it’s a good idea to use a field that contains the
<a class="xref" href="accessing-data-in-pipelines.html#accessing-ingest-metadata" title="Accessing Ingest Metadata Fields">ingest timestamp</a>. If you use a different field,
you might need to set the <code class="literal">delay</code> such that it accounts for data transmission
delays.</p>
</div>
</div>
</dd>
</dl>
</div>
</div>
</details>
</dd>
</dl>
</div>
</div>
</details>
</dd>
</dl>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="update-transform-example"></a>Examples<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/transform/apis/update-transform.asciidoc">edit</a>
</h3>
</div></div></div>
<div class="pre_wrapper lang-console">
<pre class="programlisting prettyprint lang-console">POST _transform/simple-kibana-ecomm-pivot/_update
{
  "source": {
    "index": "kibana_sample_data_ecommerce",
    "query": {
      "term": {
        "geoip.continent_name": {
          "value": "Asia"
        }
      }
    }
  },
  "description": "Maximum priced ecommerce data by customer_id in Asia",
  "dest": {
    "index": "kibana_sample_data_ecommerce_transform_v2",
    "pipeline": "add_timestamp_pipeline"
  },
  "frequency": "15m",
  "sync": {
    "time": {
      "field": "order_date",
      "delay": "120s"
    }
  }
}</pre>
</div>
<div class="console_widget" data-snippet="snippets/2161.console"></div>
<p>When the transform is updated, you receive the updated configuration:</p>
<div class="pre_wrapper lang-console-result">
<pre class="programlisting prettyprint lang-console-result">{
  "id": "simple-kibana-ecomm-pivot",
  "source": {
    "index": ["kibana_sample_data_ecommerce"],
    "query": {
      "term": {
        "geoip.continent_name": {
          "value": "Asia"
        }
      }
    }
  },
  "pivot": {
    "group_by": {
      "customer_id": {
        "terms": {
          "field": "customer_id"
        }
      }
    },
    "aggregations": {
      "max_price": {
        "max": {
          "field": "taxful_total_price"
        }
      }
    }
  },
  "description": "Maximum priced ecommerce data by customer_id in Asia",
  "dest": {
    "index": "kibana_sample_data_ecommerce_transform_v2",
    "pipeline": "add_timestamp_pipeline"
  },
  "frequency": "15m",
  "sync": {
    "time": {
      "field": "order_date",
      "delay": "120s"
    }
  },
  "version": "7.5.0",
  "create_time": 1518808660505
}</pre>
</div>
</div>

</div>
<div class="navfooter">
<span class="prev">
<a href="stop-transform.html">« Stop transforms API</a>
</span>
<span class="next">
<a href="usage-api.html">Usage API »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>